package com.qf.servlet;

import com.qf.Utils.DaoUtils;
import com.qf.entity.Student;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

/**
 * description:
 * author:zgl
 * QQ: 473584672
 */
@WebServlet(urlPatterns = "/querystu")
public class QueryStuServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<Student> stus= DaoUtils.getStudents();
        HttpSession session=req.getSession();
        session.setAttribute("students",stus);
        req.getRequestDispatcher("querystu.jsp").forward(req,resp);
    }
}
